<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" %>
<%@ include file="/resources/modular/plugin/taglibs.jsp" %>
<!doctype html>
<head content="-场地/设备">
    <%@ include file="/resources/modular/head/inside_head.jsp" %>
    <link rel="stylesheet" href="${basePath}resources/css/v2/paging.css">
    <script type="text/javascript" src="${basePath}resources/js/v2/paging.js"></script>
</head>
<body class="GC_Menu_3" name="GC_place">

<%@ include file="/resources/modular/plugin/mainMenu.jsp" %>

<div class="page">
    <%@ include file="/resources/modular/plugin/mainTopMenu.jsp" %>

    <div class="page_left combopage_left">
        <ul class="combopage_leftu1">
            <c:forEach items="${placeList}" var="data">
                <li><a href="javascript:;" name="${data.placeid}" class="${data.placeid eq placeId?'cur':''}">${data.address}</a></li>
            </c:forEach>
        </ul>
    </div>
    <div class="page_line"></div>

    <c:choose>
        <c:when test="${view==1}">
            <%@ include file="/WEB-INF/jsp/web/v3/place/_right1.jsp" %>
        </c:when>
        <c:when test="${view==2}">
            <%@ include file="/WEB-INF/jsp/web/v3/place/_right2.jsp" %>
        </c:when>
        <c:otherwise>
            <%@ include file="/WEB-INF/jsp/web/v3/place/_right1.jsp" %>
        </c:otherwise>
    </c:choose>
</div>

<!-- 新增场地 提示弹窗 -->
<div class="pointpage_dv" style="display: none;">
    <div class="pointpage_psd">
        <p class="pointpage_psdtitle">
            <strong class="pointpage_psdtitleName">新增场地</strong>
            <a href="javascript:;" class="pointpage_psdclose"></a>
        </p>
        <p class="pointpage_psdval">
            <span>场地名称：</span>
            <input class="pointpage_value" type="text" placeholder="请输入场地名称">
            <a class="pointpage_cfm" href="javascript:;">确认</a>
        </p>
    </div>
</div>
<!-- 新增场地 提示弹窗 end -->

</body>
<script type="application/javascript">
    function leftEvent(){
        $(".combopage_leftu1 a").each(function(n){
            $(this).click(function(){
                var place = $(this).attr("name");
                window.location.href = "${basePath}v3/place/"+place+"/placeView";
            });
        });
    }
    leftEvent();

    //弹窗关闭按钮
    $(".pointpage_psdclose").on("click", function(){
        $(this).parent().parent().parent().stop().hide();
    });

    //新增场地  显示
    $(".promocode_add").on("click", function(){
        $(".pointpage_value").val("");
        $(".pointpage_dv").stop().show();
    });
    //新增场地  确认
    var regName=/^\S{1,10}$/;
    $(".pointpage_cfm").on("click", function(){
        var pointpage_value=$(this).parents(".pointpage_psdval").find(".pointpage_value").val();
        if(regName.test(pointpage_value)){
            $.ajax({
                url: "${basePath}v3/place/addPlace",
                type: 'POST',
                data: {"placeName":pointpage_value},
                error: function (response) {
                    $errorMsg(response);
                },
                success: function (ret) {
                    if(ret.result==true){
                        $(".pointpage_dv").stop().hide();
                        $(".combopage_leftu1").append("<li><a name='"+ret.place+"' href='javascript:;'>"+pointpage_value+"</a></li>");
                        leftEvent();
                    }else{
                        alert(ret.info);
                    }
                }
            });
        }
    });
</script>
</html>
<%@ include file="/resources/modular/foot/inside_footer.jsp" %>
